# 用类封装一个Math类，实现加、减、乘、除、幂、开方
class MyMath:
    def add(self, a, b):
        return a + b

    def sub(self, a, b):
        return a - b

    def mul(self, a, b):
        return a * b

    def div(self, a, b):
        return a / b

    def pow(self, a, b):
        return a ** b

    def root(self, a, b):
        return a ** (1/b)

print(MyMath().add(2, 3))
print("------")

# 自由课题，按照自己的想法将身边的事物抽象成类，并创建多个实例
class study:
    subjects = None

    def __init__(self, name):
        self.name = name

class Chinese(study):
    subjects = None
    def __init__(self, name="语文课"):
        self.name = name

class Mathematics(study):
    subjects = None
    def __init__(self, name="数学课"):
        self.name = name

study_1 = Chinese()
study_2 = Mathematics()
print(f"{study_1.name}")
print(f"{study_2.name}")